/*
 * Menu.c
 *
 * Created: 2012-06-12 20:34:43
 *  Author: Sebastian_2
 */

// Originally written by Dean Camera as MICRO-MENU, modified and suited for personal needs by me

#include "Menu.h"
#include "drivers/SSD1289.h"

const Menu_Item        Null_Menu = {(void*)0, (uint8_t)0, (void*)0};
Menu_Item*       CurrMenuItem;

void MenuChange(Menu_Item* NewMenu)
{
	if ((void*)NewMenu == (void*)&NULL_ENTRY)
	  return;

	CurrMenuItem = NewMenu;
	
	/*#if defined(MENU_USE_SRAM_BUFFER)
		#if (MENU_USE_SRAM_BUFFER < 1)
		  #error Menu SRAM Buffer Size not Defined!
		#endif
		
		char Buffer[MENU_USE_SRAM_BUFFER];
		strcpy_P(Buffer, CurrMenuItem->Text);

		((WriteFuncPtr)WriteFunc)((const char*)Buffer);
	#else
		((WriteFuncPtr)WriteFunc)((const char*)CurrMenuItem->Text);	
	#endif*/

	GO_MENU_FUNC(ENTERFUNC);
}

void MenuFunc(FuncPtr* Function)
{
	if ((void*)Function == (void*)NULL_FUNC)
	  return;

	((FuncPtr)Function)();
}